<?php include $this->getViewFile('/common/Head') ?>
<body class="J_scroll_fixed">
<div class="wrap J_check_wrap">
  <?php include $this->getViewFile('/common/Nav') ?>
  <div class="h_a">查找</div>
  <form method="post" action="" id="searchForm">
    <div class="search_type cc mb10">
       <div class="mb10">
        关键字：<?php echo Form::select(array('email'=>'会员邮箱','uid'=>'会员id','username'=>'会员名称','phone'=>'手机号','taobao_user_nick'=>'旺旺号'),$sType,'name="sType"') ?>
        <input type="text" class="input length_2" name="keyword" style="width:200px;" value="<?php echo $keyword?>" placeholder="请输入搜索内容...">
        <button class="btn">搜索</button>
      </div>
    </div>
  </form>
  <div class="mb10"> 共有 ( <b><?php echo $count; ?></b> ) 个记录</div>
  <form name="myform" action="<?php echo AdminBase::U("delete") ?>" method="post" class="J_ajaxForm">
    <div class="table_list">
      <table width="100%" cellspacing="0">
        <thead>
            <tr>
              <td align="center">用户ID</td>
              <td align="center">用户名</td>
              <td align="center">金额</td>
              <td align="center" width="">时间</td>
              <td align="center" width="">状态</td>
              <td align="center" width="">备注</td>
              <td align="center" width="">操作</td>
            </tr>
        </thead>
        <tbody>
          <?php
		  foreach($data as $rs){
		  ?>
              <tr data-id="<?php echo $rs->id; ?>" >
                  <td align="center"><?php echo $rs->uid;?></td>
                  <td align="center"><?php echo $rs->username;?></td>
                  <td align="center"><?php echo $rs->money;?></td>
                  <td align="center" width=""><?php echo date('Y-m-d H:i:s',$rs->add_time) ?></td>
                  <td align="center"><?php echo MembersWithdrawalModel::getStatusHtmlDetail($rs->status); ?></td>
                  <td align="center"><?php echo $rs->remark;?></td>
                  <td align="center">
                    <?php if($rs->status == 0  && RBAC::authenticate('editwithdrawal')){
             $op[] = '<a data-id="<?php echo $rs->id; ?>" class="J_ajax_status" href="'.AdminBase::U("editwithdrawal",array('id'=>$rs->id, 'status' => 1,)).'"><font color="#FF00FF">同意申请(已返款)</font></a>';

             $op[] = '<a data-id="<?php echo $rs->id; ?>" class="J_ajax_status_reject" href="'.AdminBase::U("editwithdrawal",array('id'=>$rs->id, 'status' => 2,)).'"><font color="#FF00FF">拒绝申请</font></a>';
             echo implode('</br>', $op);
             unset($op);
                    }
                     ?>
                  </td>
              </tr>
          <?php
		  }
		  ?>
        </tbody>
      </table>
      <div class="p10">
        <div class="pages"><?php echo $Page;?></div>
      </div>
    </div>
  </form>
</div>
<script src="<?php echo $staticUrl; ?>statics/js/common.js"></script>
<script type="text/javascript">
    //同意提现
    $('.J_ajax_status').click(function() {
        var url = $(this).attr('href');
        var id = $(this).data('id');
        var obj = $(this);
        Wind.use("artDialog", function() {
            $.get(url, {}, function(data) {
                if (data.status) {
                    obj.parents('tr').eq(0).html(data.info);
                } else {
                    art.dialog({
                        icon: 'error',
                        content: data.info
                    });
                }
            }, 'json');
        });
        return false;
    });
    //拒绝提现
    $('.J_ajax_status_reject').click(function() {
        var url = $(this).attr('href');
        var id = $(this).data('id');
        var obj = $(this);
        Wind.use("artDialog", function() {
              art.dialog({
                  title:'填写理由',
                  content: "<textarea style='width:200px' name='remark'></textarea>",
                  okValue:'确定',
                  ok:function(){
                    remark = $("input[name='remark']").val();
                    if(remark == ''){
                      alert('拒绝理由不能为空');
                      return false;
                    }
                    $.post(url, {remark:remark}, function(data) {
                        if (data.status) {
                            obj.parents('tr').eq(0).html(data.info);
                        } else {
                            art.dialog({
                                icon: 'error',
                                content: data.info
                            });
                        }
                    }, 'json'); 
                    return true;                   
                  }
              });          
        });
        return false;
    });      
</script>



</body>
</html>